package cn.andy.android.crm.listener;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;

public class ShakeListener implements SensorEventListener{
	
	String TAG = "ShakeListener";
	private static final int Speed_shreshold = 3000;
	private static final int update_interval_time = 70;
	
	private SensorManager sensorManager;
	
	private Sensor sensor;
	
//	private onsha
	
	private Context context;
	
	private float lastX;
	private float lastY;
	private float lastZ;
	
	private long lastupdateTime;
	
	public ShakeListener(Context context){
		this.context = context;
		start();
	}
	
	public void start(){
		sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
		
		if(sensorManager != null){
			sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
		}
		
		if(sensor != null){
			sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_GAME);
		}
	}
	
	public void stop(){
		sensorManager.unregisterListener(this);
	}
	
	public void setOnShakeListener(){
		
	}
	

	public void onAccuracyChanged(Sensor sensor, int accuracy) {
		
	}

	public void onSensorChanged(SensorEvent event) {
		
	}

}
